<?php
require_once "Common/database.php";
require_once "Common/values.php";
require_once "js/formsubmit.php";

$duedate = date("y-m-d");
$duedate = strtotime(date("y-m-d", strtotime($duedate)) . " +5 days");
$duedate = date("y-m-d",$duedate);
list($year, $month, $day) = preg_split('[-]', $duedate);

$result = mysql_query("SELECT * FROM tblbranches WHERE BranchName='$_POST[branch]'");
while($row = mysql_fetch_array($result))
{
$_POST[branch]=$row[BranchNumber];
}

echo '<h3>New Job</h3>';
if ($ldap=='true')
{
echo '<table><tr><form method="Post" Action="helpdesk/ldapsearch.php?f=it"><td>Last Name : <input type=text name=lastname></td><td><INPUT type="image" src="img/go.gif"></td></tr></form>';
}
echo '<form method="Post" enctype="multipart/form-data" Action=helpdesk/insert.php name="jobForm" >';
echo '<table Border=1 width="100%"><tr>';
echo '<td>Log : '.'<INPUT type="hidden" name="log">';echo 'New'.'</td>';
echo '<td>Operator :<p> ';echo $user.'</td>' ;
echo '<td>Date : <INPUT type="hidden" name="date" value='.$date.'>'.$date.'</td>';
echo '<td> Time : <INPUT type="hidden" name="time" value='.$time.'>'.$time.'</td>';

echo '<tr><td>Requestor : <p><Input Type="Text" size= "25" name="requestor" value="'.$_POST['requestor'].'"></td>';
echo '<td>Project:<br><Select name="project">';
echo '<option>Helpdesk</option><option></option>';
genProjects();
echo '</select></td><td>Assigned to: <p><select name="assigned">';
echo '<option>Not Assigned</option>';
genOperator();
echo '</td>
<td colspan="2">Email updates<br><input type="text" name="mailupdates" value="'.$_POST['mail'].'" size="30"></td></tr>';
echo '<tr><td> Branch No : <p> <Select name="branch"><option>'.$_POST['branch'].'</option>';
genBranches();
echo'</select></td>  <td>Department:<p><INPUT type="text" name="department" value="'.$_POST['department'].'"></td>  <td> Phone: <p><INPUT type="text" name="phone" value="'.$_POST['phone'].'"></td>
    <td>VNC :<p> <INPUT type="text" name="vnc" size="15" maxlength="15" value='.$row['VNC'].'></td>
    <tr><td><p> Due date : <p>
    <INPUT type="text" name="dueday" size="2" value="'.$day.'">/
        <INPUT type="text" name="duemonth" size="2" value="'.$month.'">/
            <INPUT type="text"  size="2"name="dueyear" value='.$year.'></td>';
echo ' <td>Proirty:<p> <SELECT name="proirty">';
echo '<option>'.$defaultpro.'</option>';
genProirty();
echo '</SELECT></td>';
echo '<td>Status :<p> <SELECT name="status" value="'.$row['status'].'">';
echo '<option>Pending</option>';
echo'</SELECT> </TD>';
echo '<td>Private : <INPUT type="checkbox" name="private" value="checked"></td></tr>';
echo '<tr><td colspan="4">Screenshot :
<br><input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
Choose a file to upload: <input name="file" type="file"><br>
<input type="submit" value="Upload File" onClick="uploadform.submit();">
</td></TR>';

echo '<tr><td colspan=4>Subject: <INPUT TYPE="text" id="subject" size="80" NAME="subject" VALUE=""></td></tr>';
echo '<tr><td colspan=4>Problem : <br><textarea rows=5 cols=100 name="problem" value='.$row['Subject'].'>'.$row['Problem'].'</textarea></td></tr></table>';


echo '<p><INPUT type="button" name="submitbutton" value="Submit" onClick="formControl()">';


?>